
#pragma once
#pragma unmanaged


#include "AbstractEncoder.h"
#include "ejpgl/ejpgl.h"

namespace DDesktopServer
{
	class JpegEncoder : public AbstractEncoder
	{
	private:
		ejpgl::JPEGHEADER m_jpeg_header;
		unsigned int m_image_width;
		unsigned int m_image_height;
		unsigned char* m_data_buf;
		unsigned int m_data_length;

	public:

		JpegEncoder();
		virtual ~JpegEncoder();

		virtual bool Init(int width, int height);
		virtual const unsigned char* GetHeader(void) const;
		virtual const unsigned char* GetData(void) const;
		virtual int GetHeaderSize(void) const;
		virtual int GetDataSize(void) const;
		virtual bool Encode(char* data, int length);

		virtual bool WriteToFile(const char* file_name) const;
	};
}

#pragma managed
